//
//  ShoppingCartView.m
//  Project two framework
//
//  Created by rimi on 16/7/28.
//  Copyright © 2016年 张峥. All rights reserved.
//

#import "ShoppingCartView.h"
#import "ShoppingCartViewCell.h"

@interface ShoppingCartView ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic, strong) UIImageView               *imageview;
@property (strong, nonatomic) UIButton                  *addBtn;/**添加业务种类按钮*/
@property (strong, nonatomic) UILabel                   *numberLabel;
@property (strong, nonatomic) UILabel                   *businessLinesLabel;/**业务种类*/
@property (strong, nonatomic) UILabel                   *businessExplainLabel;/**业务说明*/
@property (strong, nonatomic) UIButton                  *saveIndentBtn;/**保存订单*/
@property (strong, nonatomic) UIButton                  *submitBtn;/**提交办理*/
@property (strong, nonatomic) UITableView               *tableView;
@property (strong, nonatomic) NSMutableArray            *tableViewArray;

@end

@implementation ShoppingCartView

-(instancetype)initWithFrame:(CGRect)frame
{

    self = [super initWithFrame:frame];
    if (self) {
        
//        self.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"down_05.png"]];
        
        _tableViewArray = [[NSMutableArray alloc]init];
        [self imageview];
        [self addBtn];
        [self numberLabel];
        [self businessLinesLabel];
        [self businessExplainLabel];
        [self saveIndentBtn];
        [self submitBtn];
        [self tableView];
        
    }
    return self;
}

#pragma mark --数据源
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 10;

}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *cellIndex = @"ShoppingCartViewCell";
    ShoppingCartViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIndex];
    if (cell == nil) {
        cell = [[ShoppingCartViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIndex];
        
    }

    return cell;
}


-(UIImageView *)imageview
{
    if (_imageview == nil) {
        _imageview = [[UIImageView alloc]initWithFrame:self.bounds];
        _imageview.image = [UIImage imageNamed:@"down_05.png"];
        _imageview.userInteractionEnabled = YES;
        [self addSubview:_imageview];
    }

    return _imageview;
}

-(UIButton *)addBtn
{
    if (_addBtn == nil) {
        _addBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        _addBtn.frame = CGRectMake(800, 70, 40, 40);
        [_addBtn setImage:[UIImage imageNamed:@"+_10.png"] forState:UIControlStateNormal];
        
        [_imageview addSubview:_addBtn];
    }
    return _addBtn;
}

-(UILabel *)numberLabel{
    if (_numberLabel == nil) {
        _numberLabel = [[UILabel alloc]initWithFrame:CGRectMake(75, 125, 60, 20)];
        _numberLabel.font = [UIFont boldSystemFontOfSize:16];
        _numberLabel.textAlignment = NSTextAlignmentLeft;
        _numberLabel.textColor = [UIColor whiteColor];
        _numberLabel.text = @"数量";
        _numberLabel.backgroundColor = [UIColor clearColor];
        [_imageview addSubview:_numberLabel];
    }
    return _numberLabel;
}
//业务说明
-(UILabel *)businessExplainLabel{
    if (_businessExplainLabel == nil) {
        _businessExplainLabel = [[UILabel alloc]initWithFrame:CGRectMake(500, 125, 100, 20)];
        _businessExplainLabel.font = [UIFont boldSystemFontOfSize:16];
        _businessExplainLabel.text = @"业务说明";
        _businessExplainLabel.textAlignment = NSTextAlignmentLeft;
        _businessExplainLabel.textColor = [UIColor whiteColor];
        _businessExplainLabel.backgroundColor = [UIColor clearColor];
        [_imageview addSubview:_businessExplainLabel];
    }
    return _businessExplainLabel;
}
//业务种类
-(UILabel *)businessLinesLabel{
    if (_businessLinesLabel == nil) {
        _businessLinesLabel = [[UILabel alloc]initWithFrame:CGRectMake(190, 125, 100, 20)];
        _businessLinesLabel.font = [UIFont boldSystemFontOfSize:16];
        _businessLinesLabel.textAlignment = NSTextAlignmentLeft;
        _businessLinesLabel.textColor = [UIColor whiteColor];
        _businessLinesLabel.text = @"业务种类";
        _businessLinesLabel.backgroundColor = [UIColor clearColor];
        [_imageview addSubview:_businessLinesLabel];
    }
    return _businessLinesLabel;
}
-(UIButton *)saveIndentBtn
{
    if (_saveIndentBtn == nil) {
        _saveIndentBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        _saveIndentBtn.frame = CGRectMake(260, 560, 160, 40);
        [_saveIndentBtn setImage:[UIImage imageNamed:@"save.png"] forState:UIControlStateNormal];
        
        [_imageview addSubview:_saveIndentBtn];
    }
    return _saveIndentBtn;
}
-(UIButton *)submitBtn
{
    if (_submitBtn == nil) {
        _submitBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        _submitBtn.frame = CGRectMake(450, 560, 160, 40);
        [_submitBtn setImage:[UIImage imageNamed:@"提交办理.png"] forState:UIControlStateNormal];
        
        [_imageview addSubview:_submitBtn];
    }
    return _submitBtn;
}

-(UITableView *)tableView
{
    if (_tableView == nil) {
        _tableView = [[UITableView alloc]initWithFrame:CGRectMake(30, 150, 810, 340) style:UITableViewStylePlain];
        _tableView.rowHeight =50;
        _tableView.delegate = self;
        _tableView.dataSource = self;
        [_imageview addSubview:_tableView];
    }
    return _tableView;
}




































@end
